﻿using System;
using ebc.coordinator.contract;
using ebc.message.contract;

namespace ebc.coordinator {
    public class Coordinator : ICoordinator {

        public void ProcessCoordinatorRequest(string request, Action<string> processResult) {

            string result = "";

            request = request + "=>InputRequest Coordinator\t<=CoordinatorRequest=>" + Environment.NewLine +
                "=>OutputRequest Coordiator event OnWorker\t<=WorkerRequest=>" + Environment.NewLine;
            OnWorker(request, r => result = r);

            result = result + "=>InputResult Coordinator\t<=WorkerResult=>" + Environment.NewLine +
                "=>OutputResult Coordinator\t<=CoordinatorResult=>" + Environment.NewLine;
            processResult(result);
        }

        public event Request<string, string> OnWorker;
    }
}